package com.yanqu.road.logic.activity.foxcard.game.buff;

import com.yanqu.road.entity.activity.foxcard.FoxBaseCard;
import com.yanqu.road.logic.activity.foxcard.game.FoxCardGameLogic;
import com.yanqu.road.logic.activity.foxcard.game.eFoxCardTriggerType;

import java.util.Collections;
import java.util.List;

/**
 * 幸运概率类
 * 倍率|+倍率的概率|金币|+金币的概率|0|0
 */
public class FoxCardBuff2 extends FoxCardBuffBase {
    @Override
    protected boolean buffHandle(FoxCardGameLogic gameLogic) {
        if (triggerType != eFoxCardTriggerType.SCORE) {
            return false;
        }

        int addBaseMulti = buffConfig.getParamsList().get(0);
        int addBaseMultiRandomValue = buffConfig.getParamsList().get(1);
        int goldChange = buffConfig.getParamsList().get(2);
        int goldChangeRandomValue = buffConfig.getParamsList().get(3);

        List<FoxBaseCard> settleCards = Collections.singletonList(baseCard);

        boolean isTrigger = false;

        int randomValue = gameLogic.getConfig().getRandomHelper().next(1000);
        if (addBaseMultiRandomValue > randomValue) {
            gameLogic.addBaseMulti(addBaseMulti, settleCards, null); //加基础倍率
            isTrigger = true;
        }

        randomValue = gameLogic.getConfig().getRandomHelper().next(1000);
        if (goldChangeRandomValue > randomValue) {
            gameLogic.goldChange(goldChange, settleCards, null, triggerType); //加金币
            isTrigger = true;
        }

        return isTrigger;
    }
}
